import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JPanel;


public class MyCanvas extends JPanel {

	/**
	 * 
	 */
	private Szimulacio sz;
	private int elinditva;

	public MyCanvas(int i)
	{
		elinditva = i;
	}
	public void paintComponent(Graphics g) { 
		super.paintComponent(g);
		System.out.println("Rajzol");
		if ( elinditva == 1) {
		for( int i = 0; i < sz.N ; i++)
			for( int j = 0; j < sz.N; j++)
			{
				if ( sz.a[i][j] == 1)
					g.setColor(Color.red);
				else
					g.setColor(Color.blue);
				g.fillRect(i,j,1,1);
			}
		}
 } 
	
	public Dimension getPreferredSize() {
	    return new Dimension(400, 400);
	  }
	public Dimension getMinimumSize() {
	    return getPreferredSize();
	  }
	
	public void setSzimulacio(Szimulacio sz)
	{
		this.sz = sz;
	}
	public void setElinditva(int i)
	{
		elinditva = i;
	}
}
